home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / Dlgboxes.pxl < prev    next >
Text File  |  2001-07-03  |  22KB  |  592 lines

  1. Initialize:
  2.     Title$ = "Introducing Dialog Boxes"
  3.     UseCaption(Title$)
  4.     UseCoordinates(PIXEL)
  5.     SetColorPalette(BITMAP)
  6.     UseBackground(TRANSPARENT,166,166,166)
  7.     DrawBackground
  8.     WinLocate(Title$,200,100,790,650,Res)
  9.     DirGet(SourceDir$)
  10.     AppWindowHandle(Handle,Handle$, geoPiXCLFlag,PXLMajor,Minor)
  11.  
  12.     WinShow(Title$,NOTOPMOST,Res)
  13.     InfoMenu(REMOVE)
  14.     WaitInput(100)
  15.     SetMenu("E&xit!",Leave,
  16.         ENDPOPUP,
  17.         "&Built-in DialogBoxes",IGNORE,
  18.         "TextBox", DemoTextBox,
  19.         "TextBoxEx", DemoTextBoxEx,
  20.         SEPARATOR,
  21.         "ListBox", DemoListBox,
  22.         "ListBoxEx", DemoListBoxEx,
  23.         SEPARATOR,
  24.         "PasswordBox", DemoPasswordBox,
  25.         "ImageBox", DemoImageBox,
  26.         "AboutBoxes",About,
  27.         SEPARATOR,
  28.         "SetWorkingDirBox",WorkingDirectory,
  29.         "MonthCalControl",MonthlyCalendar,
  30.         ENDPOPUP,
  31.         "C&ustom Dialogs",IGNORE,
  32.         "&Demos...",DemoCustomDlgs,
  33.         ENDPOPUP,
  34.         "&Common Dialogs",IGNORE,
  35.         "&All Demos...",DemoCommonDlgs,
  36.         "&FileGet, FileSave",DemoCommonDlgs,
  37.         "Choose&Font",ChooseFontDlg,
  38.         "&ChooseColor",DefineColorDlg,
  39.         "&Printing",PrintingBitmaps,
  40.         ENDPOPUP,
  41.         "&Help",IGNORE,
  42.         "&Concept",Concept,
  43.         "&About",About,
  44.         ENDPOPUP)
  45.  
  46.         Goto Concept
  47.  
  48. Wait_for_Input: 
  49.     If TimeString$ <> ""
  50.         DebugMsgBox(TimeString$)
  51.         TimeString$ = ""
  52.         Waiting = 0
  53.     Endif
  54.     If Waiting = 1 Then WaitInput(200)  Goto Wait_for_Input
  55.     WaitInput()
  56.  
  57. Leave:
  58.     End
  59.  
  60. About:    
  61.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  62.     DrawBackground
  63.     If geoPiXCLFlag = 1 
  64.         UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  65.         DrawText(16,16,"AboutBoxes in geoPiXCL")
  66.         UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,255,255,255)
  67.         DrawText(15,15,"AboutBoxes in geoPiXCL")
  68.     Else
  69.         UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  70.         DrawText(16,16,"AboutBoxes in PiXCL")
  71.         UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,255,255,255)
  72.         DrawText(15,15,"AboutBoxes in PiXCL")
  73.     Endif
  74.  
  75.     UseFont("Arial",7,0,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  76.     cx1 += 10  cx2 -= 10    cy1 += 70
  77.     DrawTextExt(cx1,cy1,cx2,cy2,
  78. "PiXCL/geoPiXCL provides three AboutBox styles, which will be displayed in order:
  79.  
  80. AboutPiXCL - in effect, a Splash Screen with the PiXCL logo bitmap;
  81.  
  82. AboutUser - with definable title and two text regions to describe your application; and
  83.  
  84. ShellAbout - also with definable text regions, and displays Windows information.", LEFT)
  85.  
  86.     UseFont("Arial",7,15,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  87.     DrawText(20,320,"Click anywhere to continue")
  88.     SetMouse(cx1,cy1,cx2,cy2,GoAbout,n,n)
  89.     WaitInput()
  90.  
  91. GoAbout:
  92.     SetMouse()
  93.  
  94.     AboutPiXCL
  95.  
  96.     AboutUser("About DialogBoxes",
  97.     "Learning the PiXCL Language Sample",
  98.     "Shows the various types of built-in, custom and common DialogBox styles available in PiXCL")
  99.  
  100.     TitleFirst$ = "Windows Shell AboutBox (User definable title) #"
  101.      SecondLine$ = "PiXCL Graphics and Imaging Language, copyright ⌐ 1994-2000 VYSOR Integration Inc."
  102.     ShellAbout(TitleFirst$, SecondLine$,WINLOGO)
  103.     
  104.     DrawBackground
  105.     Goto Wait_for_Input
  106.  
  107. WorkingDirectory:
  108.     RDBOpenKey(@RDB_CURRENT_USER, 
  109.         "Software\VYSOR Integration Inc\PiXCL MDI Editor\Settings",RegistryKey)
  110.     
  111.     SetWorkingDirBox("Set a working directory for your project", 
  112.     "This acesses and updates the Registry. See the source code for the exact method. You can browse for a new directory using the Browse button, or type in the new control.", 
  113.     RegistryKey, Selection$, Res)
  114.  
  115.     RDBCloseKey(RegistryKey,Res)
  116.     Goto Wait_for_Input
  117.  
  118.  
  119. MonthlyCalendar:
  120.     DrawBackground
  121.     Waiting = 1
  122.     MonthCalControl(20,30, "Display this month and next month", 2, 
  123.         TODAY,TODAYCIRCLE,WEEKNUMBERS, 
  124.         MOVE, WDDDMYYYY,TimeString$, Result)
  125.     Goto Wait_for_Input
  126.  
  127. Concept:
  128.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  129.     DrawBackground
  130.     If geoPiXCLFlag = 1 
  131.         UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  132.         DrawText(16,16,"DialogBoxes in geoPiXCL 5.0")
  133.         UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,255,255,255)
  134.         DrawText(15,15,"DialogBoxes in geoPiXCL 5.0")
  135.     Else
  136.         If PXLMajor = 4 
  137.             UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  138.             DrawText(16,16,"DialogBoxes in PiXCL 4.4")
  139.             UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,255,255,255)
  140.             DrawText(15,15,"DialogBoxes in PiXCL 4.4")
  141.         Endif
  142.  
  143.         If PXLMajor = 5 
  144.             UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  145.             DrawText(16,16,"DialogBoxes in PiXCL 5.0")
  146.             UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,255,255,255)
  147.             DrawText(15,15,"DialogBoxes in PiXCL 5.0")
  148.         Endif
  149.     Endif
  150.  
  151.     UseFont("Arial",7,0,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  152.     cx1 += 10  cx2 -= 10    cy1 += 70
  153.     DrawTextExt(cx1,cy1,cx2,cy2,
  154. "PiXCL includes a number of built-in dialog box styles, user defined dialogs, plus the Windows common dialogs. This program demonstrates how these dialogs can be used.
  155.  
  156. Start with the built-in dialogs menu items, then run some custom dialogs, look at the set of available common dialogs.",
  157.     LEFT)
  158.     Goto Wait_for_Input
  159.  
  160.  
  161.  
  162. DemoTextBox:
  163.     Text$ = "Standard text box text field. You can set default text, edit and copy to or from the clipboard."
  164.     Label$ = "Enter some data from the keyboard"
  165.     Input$ = "blah blah blah"
  166.     TextBox(Text$,Label$,Input$,Btn)
  167.     If Btn = 1
  168.         MessageBox(OK,1,INFORMATION,Input$,
  169.         "This is the result of the entry",Res)
  170.     Else
  171.         MessageBox(OK,1,EXCLAMATION,
  172.     "Your program would branch accordingly, usually to wait for more input.",
  173.         "Cancel button was pressed",Res)
  174.     Endif
  175.     Goto Wait_for_Input
  176.  
  177. DemoTextBoxEx:
  178.     Text$ = "Extended text box text field. Use this dialog when you need more information, and want to be able to add some help if your user requests it."
  179.     Label$ = "Enter some data from the keyboard"
  180.     Input$ = "blah blah blag"
  181.     Help$ = 
  182. "This is where context sensitive help is added. It appears automatically 
  183. in a MessageBox when the Help button is pressed."
  184.     TextBoxExt(Text$,Label$,Help$,Input$,Btn)
  185.     Goto Wait_for_Input
  186.  
  187. DemoListBox:
  188.     Label$ = "This is the standard ListBox"
  189.     {List$ = "AAAAAaaaaaAAAAAaaaaaAAAAAaaaaaAAAAAaaaaaAAAAAaaaaaAAAAAaaaaaAAAAA|BBBB|CCCC|DDDD|EEEE|FFFF|GGGG|HHHH|IIII|JJJJ|KKKK|LLLL|MMMM|NNNN|OOOO|PPPP|QQQQ|RRRR|SSSS|TTTT|UUUU|VVVV"}
  190.     List$ = "AAAAA|BBBB|CCCC|DDDD|EEEE|FFFF|GGGG|HHHH|IIII|JJJJ|KKKK|LLLL|MMMM|NNNN|OOOO|PPPP|QQQQ|RRRR|SSSS|TTTT|UUUU|VVVV"
  191.     Delim$ = "|"
  192.     ListBox(Label$,List$,Delim$,Res$)
  193.     Goto Wait_for_Input
  194.  
  195.  
  196. DemoListBoxEx:
  197.     Label$ = "This is the extended ListBox"
  198.     List$ = "AAAA lkajfaj[dfj adf04 q0y3r 0qydiyfa3 paoye faoif aefaergtargrgrag|BBBB|CCCC|DDDD|EEEE|FFFF|GGGG|HHHH|IIII|JJJJ|KKKK|LLLL|MMMM|NNNN|OOOO|PPPP|QQQQ|RRRR|SSSS|TTTT|UUUU|VVVV|AAAA|BBBB|CCCC|DDDD|EEEE|FFFF|GGGG|HHHH|IIII|JJJJ|KKKK|LLLL|MMMM|NNNN|OOOO|PPPP|QQQQ|RRRR|SSSS|TTTT|UUUU|VVVV|AAAA|BBBB|CCCC|DDDD|EEEE|FFFF|GGGG|HHHH|IIII|JJJJ|KKKK|LLLL|MMMM|NNNN|OOOO|PPPP|QQQQ|RRRR|SSSS|TTTT|UUUU|VVVV|AAAA|BBBB|CCCC|DDDD|EEEE|FFFF|GGGG|HHHH|IIII|JJJJ|KKKK|LLLL|MMMM|NNNN|OOOO|PPPP|QQQQ|RRRR|SSSS|TTTT|UUUU|VVVV|AAAA|BBBB|CCCC|DDDD|EEEE|FFFF|GGGG|HHHH|IIII|JJJJ|KKKK|LLLL|MMMM|NNNN|OOOO|PPPP|QQQQ|RRRR|SSSS|TTTT|UUUU|VVVV|AAAA|BBBB|CCCC|DDDD|EEEE|FFFF|GGGG|HHHH|IIII|JJJJ|KKKK|LLLL|MMMM|NNNN|OOOO|PPPP|QQQQ|RRRR|SSSS|TTTT|UUUU|VVVV"
  199.     Delim$ = "|"
  200.     Help$ = "This should be context sensitive help"
  201.     ListBoxExt(Label$,List$,Delim$,Help$,Res$)
  202.     If Res$ = "" Then Goto Wait_for_Input
  203.     DrawBackground
  204.     DrawText(10,10,Res$)
  205.  
  206.     Goto Wait_for_Input
  207.  
  208. DemoPasswordBox:
  209.     PasswordBox("PasswordBox title#1","Enter your password","Btn #1","Btn#2",Btn,Password1$)
  210.     Goto Wait_for_Input
  211.  
  212. DemoImageBox:
  213.     DrawBackground
  214.     GoSub MakeFilter
  215.     InitDir$ = ImageDir$
  216.     If Ext$ = ""  
  217.         InitFile$ = ""
  218.     Else
  219.         InitFile$ = Ext$    
  220.     Endif
  221.     Label$ = "Select an image file"
  222.     FileGet(Filter$,InitFile$,InitDir$,Label$,CHANGEDIR,Image$)
  223.     If Image$ = "" Then Goto Wait_for_Input
  224.     DirGet(ImageDir$)
  225.     FileExtension(Image$,Ext$,Res)
  226.     Ext$ = "*." + Ext$
  227.  
  228.     Text$ = 
  229. "You can write up to eleven lines of text
  230. in this region of the imagebox.  This can
  231. be image parameters like #lines, #pixels,
  232. bits per pixel, last modified date, using
  233. other PiXCL commands to create the
  234. desired text string. 
  235.  
  236. The text on the two buttons is also user
  237. definable, as shown. When you click on
  238. either button, you can cause the PiXCL
  239. application to branch as needed. "
  240.  
  241.     ImageBox("User defined ImageBox Title",Image$, Text$,
  242.         "&Button#1", "&More Info",Btn)
  243.     FreeBitMap(Image$)
  244.     
  245.     If Btn = 1
  246.         MessageBox(OK,1,INFORMATION, "First button was pressed.","Button#1", Res)
  247.     Else
  248.         MessageBox(OK,1,INFORMATION, "Second button was pressed.","More Info", Res)
  249.     Endif
  250.     Goto Wait_for_Input
  251.  
  252.  
  253. DemoCustomDlgs:
  254.     DrawBackground
  255.  
  256.     MessageBox(OKCANCEL,1,INFORMATION,
  257. "Compare this MessageBox with the one following. 
  258. Standard MessageBox command style is screen centered.",
  259.     "Standard MessageBox style",Res)
  260.  
  261.     Msg1$ = 
  262. "This is a block of text that appears in a static region in a custom dialog box created by the DialogBox command. This text wraps around and can also be centered in the region if desired. The optional icon size and position can be specified in the command."
  263.  
  264.     Msg2$ = 
  265. "Custom Dialogs can be positioned relative to the PiXCL application client area, or centered in your screen work area."
  266.  
  267.     DialogBox(10,20,260,120,"Custom Message Box using DialogBox command", CAP_NCTR,
  268.                400,110, 64,64, WINLOGO, 
  269.                190,30,240,45,"&More Info",   5,   Res,
  270.                190,10,240,25,BTN,PUSH,"Stop This &Now",    
  271.                 25,2,185,48,STATIC, LEFT, Msg1$,
  272.                 25,49,185,54,BTN,GROUP,"",
  273.                 10,2,11,84,BTN,GROUP,"",
  274.                 25,58,185,90,STATIC, LEFT, Msg2$)
  275.  
  276.     If Res = 1 Then Goto Wait_for_Input
  277.  
  278.  
  279.     Msg$ = "Please enter your UserID and Password"
  280.     Info$ = "Information"
  281.     MoreInfo$ = "User IDs and Passwords are automatically checked by the Server. Once verified you will be logged into your secure user account."
  282.     DialogBox(20,20,250,110,"Custom Password Box using DialogBox command", CAP_NCTR,
  283.                350,110, 64,64, WINLOGO, 
  284.                170,35,220,50,"&OK",   6,   Res,
  285.                170,15,220,30,BTN,PUSH,"&Cancel",  
  286.                 25,2,165,18,STATIC, LEFT, Msg$ ,
  287.                 4,17,160,30,EDIT,STRING,"",UserID$,
  288.                 4,37,160,50,EDIT,PASSWORD,"",Pwd$,
  289.                 4,52,160,88,BTN,GROUP,Info$,
  290.                 6,60,158,87,STATIC,LEFT,MoreInfo$)
  291.  
  292.  
  293.     If Res = 1 Then Goto Wait_for_Input
  294.     DrawBackground
  295.  
  296.     If UserID$ = "" Then MessageBox(OK,1,EXCLAMATION,"Invalid User ID","Cannot continue",Res) Goto Wait_for_Input
  297.  
  298.      If Pwd$ <> ""
  299.         DrawText(10,30,UserID$)  
  300.         DrawText(10,50,Pwd$) 
  301.       Endif
  302.       If Pwd$ = "" Then MessageBox(OK,1,EXCLAMATION,"Invalid Password","Cannot continue",Res) Goto Wait_for_Input
  303.  
  304.  
  305.     State1 = 1   State2 = 1
  306.     State3 = 0  State4 = 1
  307.     DialogBox(0,0,220,180,"Custom Dialog Box controls for PiXCL 4.4", CAP_NCTR,
  308.                15,25, 48,48, ICON01, 
  309.               150,42,190,54,"&Cancel", 13, Res,
  310.               150,10,190,22,BTN, PUSH,"&OK",
  311.               100,26,140,38,BTN, AUTORADIO,"Help1",State1,
  312.               150,26,190,38,BTN, AUTORADIO,"Help2",State2,
  313.               100,58,140,70,BTN, AUTOCHECK,"Check1",State3,
  314.               150,58,190,70,BTN, AUTOCHECK,"Check2",State4,
  315.               90,2,200,75,BTN, GROUP,"Group Modes",
  316.               2,2,85,90,BTN, GROUP,"Another Grouping",  
  317.               6,40,81,55,BTN, PUSH,"Complete Something",
  318.               6,60,81,75,BTN, PUSH,"Complete Another",
  319.               
  320.               90,80,200,135, COMBO,DROPDOWN,
  321.                 "Test data 1|Test data 2|Test data 3|Test data 4|Test data 5|Test data 6|Test data 7|",Res1$
  322.  
  323.               90,100,200,112,EDIT,STRING,"Edit Control",Res2$,
  324.               90,116,200,170,LIST,SINGLE,"List test data|more test information|test list information|extra list info|yet more info|still more follows|",Res3$,
  325.               5,  95, 85, 175, STATIC, CENTER,"This is some centered text in a static control region e.g. for error messages or other instructions. The font used for all dialog item text is the same as all the built-in dialogs."  ) 
  326.  
  327.     If Res <> 0
  328.         DrawBackground              
  329.         DrawNumber(10,40,Res)
  330.         DrawNumber(40,40,State1)  DrawNumber(60,40,State2)  
  331.         DrawNumber(40,60,State3)  DrawNumber(60,60,State4)  
  332.         DrawText(10,80,Res1$)
  333.         DrawText(10,100,Res2$)
  334.         DrawText(10,120,Res3$)  
  335.     Endif
  336.  
  337.     Msg$ = "Edit controls can be single or multi-line strings (like this one). Type in the control, with carriage returns. This type of control is handy to display and edit the contents of text files."
  338.     DrawBackground
  339.  
  340.     DialogBox(0,0,210,160,"Edit Control Dialog Box for PiXCL 4.4", CAP_NCTR,
  341.                15,25, 48,48, ICON01, 
  342.               30,145,80,158,"&Cancel", 2, Res,
  343.               130,145,180,158,BTN, PUSH,"&OK",
  344.               5,5,205,143,EDIT,MLSTRING,Msg$,Res2$)
  345.     
  346.     Res2$ = "Returned Editted Text: " + Res2$
  347.     DrawTextExt(30,40,400,400,Res2$,LEFT)
  348.     WaitInput(2000)
  349.  
  350.     DrawBackground
  351.     DrawShadowTextExt(30,40,400,400,
  352.     "When you use the image processing commands, it is often desirable to be able to select a set of 1, 2, 3 or more numeric values. The DialogBox command can be used to do this too. The position of the dialogs and default values are easily set by passing coordinates and defaults to the subroutines.",LEFT,255,255,255,1)
  353.  
  354.     LoRange$ = "20" 
  355.     Fdx1 = 220     Fdy1 = 70
  356.     FunctionDialogTitle$ = "Set Maximum Value"
  357.     InputValue$ = "100"
  358.     GoSub ShowFunctionDialog1 {returns FDRes}
  359.  
  360.  
  361.     LoRange$ = "20"  HiRange$ = "220"
  362.     Fdx1 = 220     Fdy1 = 70
  363.     FunctionDialogTitle$ = "Set Normalize Range Values"
  364.     GoSub ShowFunctionDialog2 {returns FDRes}
  365.  
  366.     HiRange$ = "220"
  367.     MidRange$ = "200"
  368.     LoRange$ = "180"
  369.     Fdx1 = 220     Fdy1 = 70
  370.     FunctionDialogTitle$ = "Set Gamma Values (x100)"
  371.     GoSub ShowFunctionDialog3  {returns FDRes}
  372.  
  373.     DrawBackground
  374.     DrawShadowTextExt(30,40,400,400,
  375.     "HTML based controls are also supported. This requires that Internet Explorer 4.01 or 5 has been installed, with Active Desktop. If IE4 or IE5 is not installed, this command does nothing.", LEFT,255,255,255,1)
  376.  
  377.     RDBOpenKey(@RDB_CURRENT_USER, 
  378.         "Software\VYSOR Integration Inc\PiXCL MDI Editor\Settings",RegistryKey)
  379.     RDBQueryValue(RegistryKey,"InstDir",InstDir$,Res)
  380.     RDBCloseKey(RegistryKey,Res)
  381.  
  382.  
  383.     HTMLFileName$ = InstDir$ + "\samples\sample.htm"
  384.     HTMLcontrol(0,0,CENTER,HTMLFileName$, 
  385.       "Argument 1;Argument 2;Argument 3;Argument 4;Argument 5;Argument 6",Res$, Res) 
  386.     Res$ = "The HTML Control returned string: " + Res$
  387.     DebugMsgBox(Res$)
  388.     FreeVar(Res$)
  389.  
  390.     DrawBackground
  391.     Goto Wait_for_Input
  392.  
  393. DemoCommonDlgs:
  394. FileGetDlg:
  395.     DrawBackground
  396.     UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  397.     DrawText(16,336,"Getting a Filename Common Dialog")
  398.     UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,255,255,255)
  399.     DrawText(15,335,"Getting a Filename Common Dialog")
  400.  
  401.     UseFont("Arial",7,0,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  402.     DrawTextExt(cx1,370,cx2,cy2,
  403. "You can click on a file and then the 'Open' button, or double click the file to open. What is returned to your program is the filename. You have to then do something with this filename. e.g. it is an image, pass it to a DrawBitmap command. You can also change the style of filename presentation with the buttons at the top of the dialog.",
  404.     LEFT)
  405.  
  406.     GoSub MakeFilter
  407.     InitFile$ = "*.bmp"
  408.     InitDir$ = SourceDir$
  409.     Label$ = "Testing FileGet dialog"
  410.     FileGet(Filter$,InitFile$,InitDir$,Label$,CHANGEDIR,Name$)
  411.     If Name$ = "" Then Goto Wait_for_Input
  412.     DrawText(10,10,Name$)
  413.     {Goto Wait_for_Input}
  414.  
  415.  
  416. FileSaveAsDlg:
  417.     DrawBackground
  418.     UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  419.     DrawText(16,336,"Saving a Filename Common Dialog")
  420.     UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,255,255,255)
  421.     DrawText(15,335,"Saving a Filename Common Dialog")
  422.  
  423.     UseFont("Arial",7,0,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  424.     DrawTextExt(cx1,370,cx2,cy2,
  425. "You can click on a file and then the 'Save' button, or double click the file to save. What is returned to your program is the filename. You have to then do something with this filename. e.g. it is an image, pass it to a SaveBitmap command.
  426.  
  427. You can also change the style of filename presentation with the buttons at the top of the dialog.",
  428.     LEFT)
  429.     GoSub MakeFilter
  430.     InitFile$ = "*.bmp"
  431.     InitDir$ = SourceDir$
  432.     Label$ = "Testing FileSaveAs dialog"
  433.     FileSaveAs(Filter$,InitFile$,InitDir$,Label$,CHANGEDIR,Name$)
  434.     If Name$ = "" Then Goto Wait_for_Input
  435.     DebugMsgBox(Name$)
  436.     DrawText(10,10,Name$)
  437.     {Goto Wait_for_Input}
  438.  
  439. ChooseFontDlg:
  440.     DrawBackground
  441.     UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  442.     DrawText(16,6,"ChooseFont Common Dialog")
  443.     UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,255,255,255)
  444.     DrawText(15,5,"ChooseFont Common Dialog")
  445.  
  446.     UseFont("Arial",7,0,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  447.     DrawTextExt(cx1,40,cx2,180,
  448. "Use this common dialog when you want to give the user control over the font, style and color of text to be displayed in a PiXCL application client area, or in buttons and edit controls.",
  449.     LEFT)
  450.  
  451.  
  452.     W = 9 H = 17 R = 255 G = 0 B = 0
  453.     Font$ = "Arial"
  454.     Bold = 1 Ital = 0  Undl = 1
  455.     ChooseFont(Font$,W,H,R,G,B, Bold, Ital,Undl,Strike)
  456.     If Font$ = "" Then Goto Wait_for_Input
  457.     DrawBackground
  458.     UseFontExt(Font$,W,H,Bold, Ital,Undl,Strike, R,G,B)
  459.     SelFont$ = "Selected Font style is " + Font$
  460.     DrawText(10,10, SelFont$)
  461.     DrawNumber(10,50,W)   DrawNumber(50,50,H) 
  462.     WaitInput(2000)
  463.     {Goto Wait_for_Input}
  464.  
  465. DefineColorDlg:
  466.     DrawBackground
  467.     UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  468.     DrawText(16,6,"ChooseColor Common Dialog")
  469.     UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,255,255,255)
  470.     DrawText(15,5,"ChooseColor Common Dialog")
  471.  
  472.     UseFont("Arial",7,0,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  473.     DrawTextExt(cx1,40,cx2,cy2,
  474. "Pens, brushes, fonts and fill colors can be selected from the ChooseColor dialog. There are two dialog size styles, standard and full, that provide user color selection. 
  475.  
  476. Additionally, the dialog position, title string, basic and custom strings can be specified.
  477.  
  478. The 16 custom colors can be set and reset with the CustomColor command. These colors remain in force until changed, or until the PiXCL application terminates. You could also store and recall these colors in the Registry or in an INI file.",
  479.     LEFT)
  480.  
  481.     WaitInput(5000)
  482.  
  483.     Red = 255 Green = 0 Blue = 255
  484.     ChooseColor(STD,Red,Green,Blue,200,300,"Standard colour selection","Available basic colors","Custom colours set to default")
  485.     If Red = -1 Then Goto Wait_for_Input
  486.     {Goto Wait_for_Input}
  487.  
  488. ChooseColorDlg:
  489.     Red = 255 Green = 0 Blue = 255
  490.     {Have to set these to default values}
  491.  
  492.     CustomColor(255,0,0,  0,255,0,  0,0,255,  255,255,0,
  493.         0,255,0,  0,255,255, 192,192,192, 255,160,0,
  494.         160,255,0, 0,255,160, 0,0,255,     255,255,0,
  495.         0,255,0, 0,255,255, 255,255,255, 255,255,255)
  496.  
  497.  
  498.     ChooseColor(STD,Red,Green,Blue,200,300,"Standard colour selection","","Custom colours defined by command")
  499.     If Red = -1 Then Goto Wait_for_Input
  500.     UseBackground(TRANSPARENT,Red,Green,Blue)
  501.     DrawBackGround
  502.     ChooseColor(FULLRGB,Red,Green,Blue)
  503.     If Red = -1 Then Goto Wait_for_Input
  504.     UseBackground(TRANSPARENT,Red,Green,Blue)
  505.     DrawBackGround
  506.  
  507.     {Goto Wait_for_Input}
  508.  
  509. PrintingBitmaps:
  510.     UseBackground(TRANSPARENT,166,166,166)
  511.     DrawBackGround
  512.     UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  513.     DrawText(16,6,"PageSetup / Print Common Dialogs")
  514.     UseFont("Arial",13,29,NOBOLD,NOITALIC,NOUNDERLINE,255,255,255)
  515.     DrawText(15,5,"PageSetup / Print Common Dialogs")
  516.  
  517.     UseFont("Arial",7,0,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  518.     DrawTextExt(cx1,40,cx2,cy2,
  519. "These are used in printing files and bitmaps.",LEFT)
  520.     
  521.     WaitInput(2000)
  522.     FileToPrint$ = SourceDir$ + "\bitmap.bmp"
  523.     FileExist(FileToPrint$,Res)
  524.     If Res = 0 
  525.         DrawBackground
  526.         MessageBox(OK,1,EXCLAMATION,"File to be printed cannot found.",FileToPrint$,Res)
  527.     Else
  528.             PrintBitmap(FileToPrint$,SETUP,Res)
  529.         UseFont("Arial",9,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  530.         PrintBitmap(FileToPrint$,PRINT_PAGERES,Res) 
  531.     Endif
  532.     DrawBackground
  533.     Goto Wait_for_Input
  534.  
  535. MakeFilter:
  536.     Filter$ = "BMP Files(*.bmp),*.bmp,OS2 Files(*.os2),*.os2,"
  537.     Filter$ = Filter$ + "JPEG Files(*.jpg),*.jpg,"
  538.     Filter$ = Filter$ + "PCD Files(*.pcd),*.pcd,"
  539.     Filter$ = Filter$ + "PCX Files(*.pcx),*.pcx,"
  540.     Filter$ = Filter$ + "PNG Files(*.png),*.png,"
  541.     Filter$ = Filter$ + "PPM Files(*.ppm),*.ppm,"
  542.     Filter$ = Filter$ + "RAS Files(*.ras),*.ras,"
  543.     Filter$ = Filter$ + "RLE Files(*.rle),*.rle,"
  544.     Filter$ = Filter$ + "TGA Files(*.tga),*.tga,"
  545.     Filter$ = Filter$ + "TIF Files(*.tif),*.tif"
  546.  
  547.     Return
  548.  
  549. ShowFunctionDialog1: {subroutine: one numeric input }
  550.     Fdx2 = Fdx1 + 150
  551.     Fdy2 = Fdy1 + 50
  552.     DialogBox(Fdx1, Fdy1,Fdx2,Fdy2,FunctionDialogTitle$,CAP_NCTR,
  553.         5,15,24,24,QUESTION,
  554.         110,25,145,40,"&Cancel",4,FDRes,  {returns 0}
  555.         110,5,145,20,BTN,PUSH,"&OK",  {returns 1}
  556.         20,5,105,45,BTN,GROUP,"Numeric Input", {edit string}
  557.         48,23,100,33,STATIC,LEFT,"Input value", {edit string}
  558.         25,17,45,27,EDIT,NUMBER,InputValue$,InputValue$)
  559.     Return
  560.  
  561.  
  562. ShowFunctionDialog2: {subroutine: two numeric inputs}
  563.     Fdx2 = Fdx1 + 150
  564.     Fdy2 = Fdy1 + 50
  565.     DialogBox(Fdx1, Fdy1,Fdx2,Fdy2,FunctionDialogTitle$,CAP_NCTR,
  566.         5,15,24,24,QUESTION,
  567.         110,25,145,40,"&Cancel",6,FDRes,  {returns 0}
  568.         110,5,145,20,BTN,PUSH,"&OK",  {returns 1}
  569.         20,5,105,45,BTN,GROUP,"Numeric Input", {edit string}
  570.         48,17,100,27,STATIC,LEFT,"High range value", {edit string}
  571.         25,17,45,27,EDIT,NUMBER,HiRange$,HiRange$,
  572.         48,29,100,39,STATIC,LEFT,"Low range value", {edit string}
  573.         25,29,45,39,EDIT,NUMBER,LoRange$,LoRange$)
  574.     Return
  575.  
  576.  
  577. ShowFunctionDialog3: {subroutine: three numeric inputs}
  578.     Fdx2 = Fdx1 + 150
  579.     Fdy2 = Fdy1 + 65
  580.     DialogBox(Fdx1, Fdy1,Fdx2,Fdy2,FunctionDialogTitle$,CAP_NCTR,
  581.         5,15,24,24,QUESTION,
  582.         110,35,145,50,"&Cancel",8,FDRes,  {returns 0}
  583.         110,15,145,30,BTN,PUSH,"&OK",  {returns 1}
  584.         20,5,105,55,BTN,GROUP,"Numeric Input", {edit string}
  585.         48,17,100,27,STATIC,LEFT,"High range value", {edit string}
  586.         25,17,45,27,EDIT,NUMBER,HiRange$,HiRange$,
  587.         48,29,100,39,STATIC,LEFT,"Mid range value", {edit string}
  588.         25,29,45,39,EDIT,NUMBER,MidRange$,MidRange$,
  589.         48,41,100,51,STATIC,LEFT,"Low range value", {edit string}
  590.         25,41,45,51,EDIT,NUMBER,LoRange$,LoRange$)
  591.     Return
  592.